<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>人员展示</title>
    <script src="../../../../../res/js/jquery-3.4.1.min.js"></script>
    <script charset="utf-8" src="../../../../../res/layui/layui.js"></script>
    <script src="../../../../../res/js/Tools.js"></script>
    <link href="../../../../../res/layui/css/layui.css" media="all" rel="stylesheet">
    <link href="../../../../../res/echarts/eleTree.css" rel="stylesheet"/>
    <script src="../../../../../res/echarts/eleTree.js"></script>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../../res/images/favicon.ico">
    <script charset="utf-8" src="../../../../../res/js/login_common.js"></script>
    <style type="text/css">
        body {
            padding: 10px;
        }
        .showFont{
            line-height: 38px;
        }
    </style>
    <script>
        $.ajaxSetup({
            async: false
        });
    </script>
</head>
<body>
<form action="" class="layui-form layui-form-pane">
    <input type="hidden" id="pkDepartmentId" name="pkDepartmentId">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-inline">
                <input  class="layui-input" readonly id="departmentName"  type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">部门领导</label>
            <div class="layui-input-inline">
                <input autocomplete="off" class="layui-input" readonly id="personnelId"
                       type="text">
            </div>
        </div>
        <div class="layui-inline" >
            <label class="layui-form-label">编号</label>
            <div class="layui-input-inline" >
                <input autocomplete="off" class="layui-input" readonly id="departmentCode"
                       type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">上级类型</label>
            <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" readonly id="superiorType"
                           type="text">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上级</label>
        <div class="layui-input-block" id="department1" >
            <input autocomplete="off" class="layui-input" readonly id="departmentSuperior"
                   type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline" >
            <label class="layui-form-label">上级领导</label>
            <div class="layui-input-inline" >
                <input autocomplete="off" class="layui-input" readonly id="personnelSuperior"
                       type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮箱地址</label>
            <div class="layui-input-inline" >
                <input  class="layui-input"  readonly
                       id="departmentEmil" type="text">
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">关键字</label>
            <div class="layui-input-inline" >
                <input  class="layui-input"  readonly id="keyword"
                       type="text">
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea class="layui-textarea" name="remark" id="remark" ></textarea>
        </div>
    </div>
</form>

<script>
    var from=null;
    layui.use(['form', 'layedit', 'laydate', 'layer'], function () {
         form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        //表单取值
        layui.$('#LAY-component-form-getval').on('click', function () {
            var data = form.val('example')
        });

        //修改操作
        var ide = getQueryString("pkDepartmentId");
        if (ide) {
            findById(ide);//修改页面的赋值
        }
        //重新渲染表单函数
        function renderForm() {
            layui.use('form', function () {
                var form = layui.form(); //高版本建议把括号去掉，有的低版本，需要加()
            });
        }
        form.render();
    });


    function findById(ide) {
        let url = getRootPath() + "OaDepartmentAction/findById/" + ide;
        let data=getAjaxById(url);
        $("#pkDepartmentId").val(data.data.pkDepartmentId);
        $("#departmentName").val(data.data.departmentName);
        $("#departmentCode").val(data.data.departmentCode);
        $("#departmentEmil").val(data.data.departmentEmil);
        if(data.data.superiorType==="0"){
            $("#superiorType").val("公司");
            $("#departmentSuperior").val(data.data.superiorCompanyName);
        }else{
            $("#superiorType").val("部门");
            $("#departmentSuperior").val(data.data.superiorDepartmentName);
        }
        $("#remark").val(data.data.remark);
        $("#keyword").val(data.data.keyword);
        $("#personnelId").val(data.data.personnelName);
        $("#personnelSuperior").val(data.data.superiorPersonnelName);
    }

</script>
</body>
</html>